//
//  MapIconView.m
//  Operator
//
//  Created by Ardi Tjandra on 12/6/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MapIconView.h"
#import "MapIcon.h"

@implementation MapIconView
@synthesize imageView = _imageView;

- (id)initWithAnnotation:(id )recAnnotation reuseIdentifier:(NSString *)recReuseIdentifier {
	MapIcon* myAnnotation = (MapIcon*)recAnnotation;
	NSString *indexPath = @"";
	
	self = [super initWithAnnotation:myAnnotation reuseIdentifier:recReuseIdentifier];
	
    switch (myAnnotation.type) {
        case MapIconTypeCheckpoint:
            indexPath = [[NSBundle mainBundle] pathForResource:@"cp" ofType:@"png"];
            break;
            
        case MapIconTypeBase:
            indexPath = [[NSBundle mainBundle] pathForResource:@"b"  ofType:@"png"];
            break;
            
        case MapIconTypeOwnRunner:
            indexPath = [[NSBundle mainBundle] pathForResource:@"r1" ofType:@"png"];
            break;
            
        case MapIconTypeOwnHunter:
            indexPath = [[NSBundle mainBundle] pathForResource:@"h1" ofType:@"png"];
            break;
            
        case MapIconTypeOtherRunner:
            indexPath = [[NSBundle mainBundle] pathForResource:@"r2" ofType:@"png"];
            break;
            
        case MapIconTypeOtherHunter:
            indexPath = [[NSBundle mainBundle] pathForResource:@"h2" ofType:@"png"];
            break;
          
        default:
            break;
    }
	[self setImageUrl:indexPath];
	
	return self;
}

-(void) dealloc {
	[_imageView release];
	[super dealloc];
}


@end
